package Terminal.UI;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.Label;

import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class TitoloVecchio extends PanelComponent{
	
	private JLabel immaginelabel;
	private GridBagConstraints ct;
	private GridBagLayout gridbagt;
//	private JPanel panelt;
	private JLabel Timelogginglabel;


	public TitoloVecchio(){
		super();
		ct = new GridBagConstraints();
		gridbagt = new GridBagLayout();
		pannellocomponente = new JPanel(gridbagt);
		
			
	}
	
	public TitoloVecchio(PanelComponent padre){
		super(padre);
		ct = new GridBagConstraints();
		gridbagt = new GridBagLayout();
		pannellocomponente = new JPanel(gridbagt);
	}

	
	public JPanel createComponents(){
		//panelt= super.createComponents();

		immaginelabel = new JLabel();
		try {
			ImageIcon imm = new ImageIcon("src\\imm\\images.jpg");
			immaginelabel.setIcon(imm);
		} catch (Exception e1) {
			System.out.print("immagine non caricata");
			immaginelabel.setText("o");
			immaginelabel.setForeground(Color.blue);
			immaginelabel.setBackground(Color.blue);
			immaginelabel.setMinimumSize(new Dimension(150, 150));
			immaginelabel.setPreferredSize(new Dimension(150, 150));
			immaginelabel.setMaximumSize(new Dimension(150, 150));
			}
		
		ct.fill = GridBagConstraints.BOTH;
		ct.gridx=0;
		ct.gridy=0;
		ct.gridwidth = 1;	   	   
		ct.gridheight = 1;
	    ct.weighty = 1.0;
	    ct.weightx = 1.0;
	    ct.insets=new Insets(5, 5, 0, 0);
	   // c.ipadx=10;
	   // c.ipady=10;
	    System.out.print("3");
	    gridbagt.setConstraints(immaginelabel, ct);
	    //panelt
	    pannellocomponente.add(immaginelabel);
	    
	    
	    Timelogginglabel= new JLabel("TimeLogging");
		
		ct.fill = GridBagConstraints.BOTH;
		ct.gridx=1;
		ct.gridy=0;
		ct.gridwidth = 9;	   	   
		ct.gridheight = 1;
	    ct.weighty = 1.0;
	    ct.weightx = 1.0;
	    ct.insets=new Insets(5, 5, 0, 0);
	   // c.ipadx=10;
	   // c.ipady=10;
	    gridbagt.setConstraints(Timelogginglabel, ct);
	    //panelt
	    pannellocomponente.add(Timelogginglabel);
	    Timelogginglabel.setFont(new Font( "Cominc",Font.PLAIN,44));
	    Timelogginglabel.setHorizontalAlignment(Label.RIGHT);
	    Timelogginglabel.setPreferredSize(new Dimension(304,57));
	    
	    size_width=immaginelabel.getPreferredSize().width+Timelogginglabel.getPreferredSize().width;
	    if(immaginelabel.getPreferredSize().height>Timelogginglabel.getPreferredSize().height){size_height=immaginelabel.getPreferredSize().height;}else{size_height=Timelogginglabel.getPreferredSize().height;}
	    
	    setSize(size_width,size_height);
	   
	    
	    return pannellocomponente;
	}
	
	public void updateSize(){}
	
}
